<template>
  <div class="foreign">
    <div v-for="(item, index) in soilData" :key="index" @click="goRouter(item)">
      <div class="for-img">
        <img :src="item.img" alt />
      </div>
      <div class="for-font">
        <div class="for-title">
          <div>{{item.type}} &ensp;</div>
          <div style="margin:0 4px">|</div>
          <div>{{item.name}}</div>
        </div>
        <div class="for-text">&nbsp;{{item.summary}}</div>
      </div>
    </div>
  </div>
</template>

<script>
import { detailsAddViews } from "@/api/home/api";
export default {
  props: ["soilData"],
  methods: {
    goRouter({ id }) {
      detailsAddViews({ id, type: 4 }).then(res => {
        let data = res.data;
        let details = JSON.stringify(data.dataList[0]);
        this.$router.push({ path: "/home/news/other", query: { details } });
      });
    }
  }
};
</script>

<style scoped>
.foreign {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
}
.foreign > div {
  cursor: pointer;
  width: 50%;
  display: flex;
  margin-bottom: 40px;
}
.foreign > div > div {
  margin-right: 18px;
}
.for-img {
  width: 43.6%;
  border: 1px solid #ddd;
}
.for-font {
  width: 56.4%;
}
.for-img img {
  width: 100%;
  height: 100%;
}
.for-title {
  display: flex;
  color: #5d5e60;
  cursor: pointer;
  height: 52px;
  border-bottom: 1px solid #e7e7e7;
}
.for-title > div:hover {
  color: #0dbd95;
}
.for-text {
  color: #aaa;
  padding-top: 12px;
  font-size: 12px;
  line-height: 24px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.for-text:hover {
  color: #000;
}
</style>